//
//  AIHomeCollectionReusableView.m
//  aixianfeng
//
//  Created by wangwei on 2016/12/24.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

#import "AIHomeCollectionReusableView.h"
//导入图片轮播器的View
#import "AIWheelPlayerView.h"

//导入中间View
#import "AIHomeIconsFourView.h"

//创建活动的View
#import "AIHomeActivitiesView.h"

#import "AIHomeModel.h"
#import "AIHomeActivitiesModel.h"
#import "AIHomeIconsModel.h"
#import "AIHomeFocusModel.h"
#import "AIHomeItemModel.h"



@interface AIHomeCollectionReusableView()

@property (nonatomic,weak)AIWheelPlayerView *wheelPlayerView;

@property (nonatomic,weak)AIHomeIconsFourView *iconsView;

@property (nonatomic,weak)AIHomeActivitiesView *acitvitesView;

@end

@implementation AIHomeCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setupUI];
        
    }
    return self;
}

//设置UI界面
- (void)setupUI{
    
    //第一个创建轮播器
    AIWheelPlayerView *wheelPlayerView = [[AIWheelPlayerView alloc] initWithFrame:CGRectMake(0, 0, LeeScreenWidth, 0.2 * LeeScreenHeight)];
    self.wheelPlayerView = wheelPlayerView;
    [self addSubview:wheelPlayerView];
    [self layoutIfNeeded];
    
    //创建中间四个Button 的View iconsView
    CGFloat iconViewX,iconViewY,iconViewW,iconViewH;
    iconViewX = CGRectGetMinX(self.wheelPlayerView.frame);
    iconViewY = CGRectGetMaxY(self.wheelPlayerView.frame) + Margin;
    iconViewW = wheelPlayerView.bounds.size.width;
    iconViewH = 0.16 * LeeScreenHeight;
    
    AIHomeIconsFourView *iconsView = [[AIHomeIconsFourView alloc] initWithFrame:CGRectMake(iconViewX, iconViewY, iconViewW, iconViewH)];
    [self addSubview:iconsView];
    self.iconsView = iconsView;
   
    //创建中间的四个条
    CGFloat acitvitesViewX,acitvitesViewY,acitvitesViewW,acitvitesViewH;
    acitvitesViewX = CGRectGetMinX(self.iconsView.frame) + Margin;
    acitvitesViewY = CGRectGetMaxY(self.iconsView.frame) + Margin;
    acitvitesViewW = self.iconsView.bounds.size.width - 2 * Margin;
    acitvitesViewH = LeeScreenHeight - acitvitesViewY - 10;
    
    AIHomeActivitiesView *acitvitesView = [[AIHomeActivitiesView alloc] initWithFrame:CGRectMake(acitvitesViewX, acitvitesViewY, acitvitesViewW, acitvitesViewH)];
    [self addSubview:acitvitesView];
    self.acitvitesView = acitvitesView;
    
//    //创建小黑条
//    CGFloat blackViewLineX,blackViewLineY,blackViewLineW,blackViewLineH ;
//    blackViewLineX = CGRectGetMinX(self.acitvitesView.frame);
//    blackViewLineY = CGRectGetMaxY(self.acitvitesView.frame);
//    blackViewLineW = self.acitvitesView.bounds.size.width;
//    blackViewLineH =  10;
//    UIView *blackViewLine = [[UIView alloc] initWithFrame:CGRectMake(blackViewLineX, blackViewLineY, blackViewLineW, blackViewLineH)];
//    blackViewLine.backgroundColor = [UIColor blackColor];
//    [self addSubview:blackViewLine];
}

- (void)setFocusArray:(NSArray<AIHomeFocusModel *> *)focusArray {
    _focusArray = focusArray;
   self.wheelPlayerView.focusModelArray = self.focusArray;
}

- (void)setIconsArray:(NSArray<AIHomeIconsModel *> *)iconsArray {
    _iconsArray = iconsArray;
    self.iconsView.iconsModelArray = self.iconsArray;
}

- (void)setActivitiesArray:(NSArray<AIHomeActivitiesModel *> *)activitiesArray {
    _activitiesArray = activitiesArray;
    self.acitvitesView.activitiesArray = self.activitiesArray;
}

@end
